import Vue from 'vue'
import VueRouter from 'vue-router'

const routes = [
  // 首页
  {
    path: '/index',
    name: 'index',
    component: () => import("../views/index")
  },
  // 404页面
  {
    path: '/404',
    name: 'notfound',
    component: () => import("../views/404.vue")
  },
  // 重定向
  {
    path: '/',
    redirect: { name: 'index' }
  },
  {
    path: '*',
    redirect: { name: 'notfound' }
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
})


Vue.use(VueRouter)

export default router